package com.zb.yaml;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 读取配置文件工具类
 * @Author WEN
 * @Date 2023/8/11 0011
 **/
@Component
public class FilePath {
    private static FilePath filePath;

    @Value("${file.annex.uploadPath}")
    private String annexUploadPath;

    @Value("${file.annex.visitPath}")
    private String annexVisitPath;

    @Value("${file.video.uploadPath}")
    private String videoUploadPath;

    @Value("${file.video.visitPath}")
    private String videoVisitPath;



    @PostConstruct
    public void init() {
        filePath = this;
        filePath.annexUploadPath = this.annexUploadPath;
        filePath.videoUploadPath = this.videoUploadPath;
        filePath.annexVisitPath = this.annexVisitPath;
        filePath.videoVisitPath = this.videoVisitPath;
    }

    /**
     * 获取域名
     * @return
     */
    public static String domain() {
        return DomainPath.domain();
    }

    /**
     * 附件上传路径
     * @return
     */
    public static String annexUploadPath() {
        return filePath.annexUploadPath;
    }

    /**
     * 附件访问路径
     * @return
     */
    public static String annexVisitPath() {
        return filePath.annexVisitPath;
    }

    /**
     * 视频上传路径
     * @return
     */
    public static String videoUploadPath() {
        return filePath.videoUploadPath;
    }

    /**
     * 视频访问路径
     * @return
     */
    public static String videoVisitPath() {
        return filePath.videoVisitPath;
    }
}
